import 'package:flutter/material.dart';

class Sliver02 extends StatefulWidget {
  const Sliver02({Key key}) : super(key: key);

  @override
  _Sliver02State createState() => _Sliver02State();
}

class _Sliver02State extends State<Sliver02>
    with SingleTickerProviderStateMixin {
  AnimationController _controller;

  @override
  void initState() {
    super.initState();
    _controller = AnimationController(vsync: this);
  }

  @override
  void dispose() {
    super.dispose();
    _controller.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: CustomScrollView(
        slivers: [
          SliverAppBar(
            title: Text('data'),
            floating: true, //往下拉即出现
            snap: true, //一般配合floating 是否直接全部展示
            // pinned: true,//一直显示 和普通的appbar区别在于阴影 sliver的阴影在有东西的时候才会有 否则没有
            expandedHeight: 300, // 下拉高度 一般配合西边两个使用
            stretch: true, // 允许线向下拉伸
            flexibleSpace: FlexibleSpaceBar(
              // 下来后的样式
              background: FlutterLogo(),
              title: Text('FlexibleSpaceBar - title'),//title
              collapseMode: CollapseMode.pin, //回缩效果
              stretchModes: [
                //拉伸效果
                StretchMode.blurBackground,
                StretchMode.fadeTitle,
                StretchMode.zoomBackground
              ],
            ),
          ),
          SliverToBoxAdapter(
            child: Placeholder(),
          ),
          SliverList(
              delegate: SliverChildListDelegate([
            FlutterLogo(size: 100),
            FlutterLogo(size: 360),
            FlutterLogo(size: 60),
            FlutterLogo(size: 200),
          ]))
        ],
      ),
    );
  }
}
